//
//  CameraViewController.m
//  OST
//
//  Created by mac on 13-7-6.
//  Copyright (c) 2013年 mac. All rights reserved.
//

#import "CameraViewController.h"

@interface CameraViewController ()

@end

@implementation CameraViewController
@synthesize camConfig;
@synthesize mainView;

- (void)viewDidLoad
{
    [super viewDidLoad];
    cameraView = [[[NSBundle mainBundle] loadNibNamed:@"CameraView" owner:self options:nil]lastObject];
    [cameraView initView];
    cameraView.frame = mainView.bounds;
    [cameraView setTheCamConfig:camConfig];
    [mainView addSubview:cameraView];
}

-(IBAction)cut:(id)sender
{
    [self showMHUD:@"正在保存..."];
    UIImage *image =cameraView.cameraImageView.image;
    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    [self hideMHUD:@"保存成功" success:YES];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:YES];
}


@end
